package com.devplatform.service.impl.points;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.devplatform.mapper.points.PointsReasonMapper;
import com.devplatform.pojo.points.PointsReason;
import com.devplatform.service.points.PointsReasonService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author 86156
 * @description 针对表【points_reason】的数据库操作Service实现
 * @createDate 2025-09-28 14:44:44
 */
@Service
public class PointsReasonServiceImpl extends ServiceImpl<PointsReasonMapper, PointsReason>
        implements PointsReasonService {

    @Resource
    private PointsReasonMapper pointsReasonMapper;

    @Override
    public PointsReason getByReasonCode(String reasonCode) {

        PointsReason reason = pointsReasonMapper.selectByReasonCode(reasonCode);
        if (reason == null) {
            throw new RuntimeException("未找到积分规则：" + reasonCode);
        }
        return reason;
    }

}




